<%@page import="edu.tsinghua.eea.powermanagementserver.model.DBInterface, java.util.Date,
java.text.SimpleDateFormat"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" session="true" %>
<%
Integer uid = (Integer)request.getSession().getAttribute("UID");
String uname = "NULL";
if(uid == null || uid <= 0){
	// 未登录或登录失败
	response.sendRedirect("userlogin.jsp");
} else {
	uname = (String)request.getSession().getAttribute("UName");
}
SimpleDateFormat cDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>能量管理系统</title>
<link href="css/styles.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="js/main.js"></script>
</head>
<body class="bgz">
<div id="admin_head" class="header fleft" >
<!-- 	此处为标题栏 -->
	<a href="dbcon?action=logout" class='info_right' style='padding: 5px;'>退出</a>
	<div class="info_right">
		<%=uname %>，欢迎你！  本次登录时间：
		<%=cDateFormat.format(new Date()) %>
	</div>
	<div class="clear"></div>
	<div>
		<div id="header_title" class="fleft" >能量管理系统</div>
		<div id=header_version" class="fleft" >ver1.0</div>
		<div class="clear"></div>
	</div>
	<div class="vgap"></div>
</div>
<div id="main_page bg_trans" class="wfill">
	<div class="fleft wfill">
<!-- 以下为左边栏 -->
		<div id="leftFrame" class="fleft">
			<div>
	<!-- 		此处为左边栏 -->
			<div id="left_list" class="list"><%
			Integer si = (Integer)request.getSession().getAttribute("li_sel");
			if(si == null)
				si = DBInterface.mListIndex[0];
			int iItem = 0;
			String sItem = "";
			boolean isItemSelected = false;
			for(int i=0; i<DBInterface.mListIndex.length; i++){
				iItem = DBInterface.mListIndex[i];
				sItem = DBInterface.mListName[i];
				isItemSelected = (si.compareTo(iItem) == 0);
				
				if(isItemSelected){
					out.println("<div id='li_" + iItem + "' class='listitem item_selected'>");
					out.println("<span class='listitem item_selected'>");
					out.println("<a class='listitem item_selected' title='" + sItem 
							+ "' target='_top' href='dbcon?action=list_item&si=" + iItem + "'>" + sItem + "</a>");
				} else {
					out.println("<div id='li_" + iItem + "' class='listitem'>");
					out.println("<span class='listitem'>");
					out.println("<a class='listitem' title='" + sItem 
							+ "' target='_top' href='dbcon?action=list_item&si=" + iItem + "'>" + sItem + "</a>");
				}
				out.println("</span>");
				out.println("</div>");
			}
			%>
<!-- 				<div id="li_1" class="listitem item_selected"> -->
<!-- 					<span class="listitem item_selected"> -->
<!-- 						<a class="listitem item_selected" title="选项1" target="_top" href="dbcon?action=list_item&si=1">选项1</a> -->
<!-- 					</span> -->
<!-- 				</div> -->
<!-- 				<div id="li_2" class="listitem"> -->
<!-- 					<div class="hgap"></div> -->
<!-- 					<span class="listitem"> -->
<!-- 						<a class="listitem" title="选项2" target="_top" href="dbcon?si=2">选项2</a> -->
<!-- 					</span> -->
<!-- 				</div> -->
<!-- 				<div id="li_3" class="listitem"> -->
<!-- 					<div class="hgap"></div> -->
<!-- 					<span class="listitem"> -->
<!-- 						<a class="listitem" title="选项3" target="_top" href="dbcon?si=3">选项3</a> -->
<!-- 					</span> -->
<!-- 				</div> -->
			</div>
			</div>
		</div>
<!-- 以下为右侧主界面	 -->
		<div id="rightFrame">
			<%if(si>0 && si<6){
				%><jsp:include page='<%="admin/ui"+si+".jsp" %>'/><%
			} else {%>
				<div style="width: 400px; min-height: 400px; text-align: center; vertical-align: middle;">
					此处为主界面
				</div><%
			}%>
		</div>
	</div>
	<div class="clear"></div>
</div>
<div class="clear"></div>
<div class="page_tail">
	<span> &copy;2011&nbsp;Electrical engineering department, Tsinghua University</span>
	<span> &nbsp;&nbsp;&nbsp;&nbsp;</span>
	<span>
		 联系我们:&nbsp;
		 <a class="font_white" target="_blank" href="mailto://ywx217@gmail.com/">ywx217@gmail.com</a>
	</span>
</div>
</body>
</html>